{% extends "common/layout.html" %}
{% block content %}

    <div class="row bg-primary">
        <div class="col-sm-10 col-sm-offset-1">
            <h2>文件信息收集系统</h2>
            <h6>Document and information collection system</h6>
        </div>
    </div>


    <div class="row">
        <div class="col-sm-10 col-sm-offset-1">
            <ol class="breadcrumb" style="background:#ffffff">
                <li><a href="{{ buildUrl('/collect/collectall') }}">首页</a></li>
                <li>
                    <a href="{{ buildUrl('/collect/collectindex') }}?id={{ collectall.id }}'">{{ collectall.part }}-{{ collectall.name }}</a>
                </li>
                <li class="active">{{ collectindex.name }}</li>
            </ol>
        </div>
    </div>

    {#内容#}
    <div class="col-sm-10 col-sm-offset-1">
        <div class="row">
            <div class="row">
                {#管理员#}
                {% for item in current_user.role | tolist %}
                    {% if item == "区域人事行政" %}
                        {% for item in collectdetail %}
                            <div class="col-sm-2" style="height: 400px">
                                <div class="row">
                                    <div class="col-sm-8">
                                        <a type="button" class="btn btn-danger btn-sm"
                                           href="{{ buildUrl('/collect/detaildelete') }}?id={{ item.id }}'">删除
                                        </a>
                                    </div>
                                </div>
                                <div class="thumbnail" onclick="window.location='{{ item.url }}';">
                                    {#                            <a href="{{ item.url }}">#}
                                    {% if item.type=="xls" or item.type=="xlsx" %}
                                        <img src="/static/pic/ico/excel.png" alt="...">
                                    {% elif item.type=="pdf" %}
                                        <img src="/static/pic/ico/pdf.png" alt="...">
                                    {% elif item.type=="doc" or item.type=="docx" %}
                                        <img src="/static/pic/ico/word.png" alt="...">
                                    {% elif item.type=="jpg" or item.type=="jepg" or item.type=="png" %}
                                        <img src="/static/pic/ico/img.png" alt="...">
                                    {% else %}
                                        <img src="/static/pic/ico/file.png" alt="...">
                                    {% endif %}
                                    {#                            </a>#}
                                    <div class="caption">
                                        <div class="btn-group btn-group-justified " role="group"
                                             aria-label="...">
                                            <div class="btn-group" role="group">
                                                <h4 class="text-center"><strong>{{ item.name }}</strong></h4>
                                                <ul class="list-unstyled">
                                                    <li> 上传人员:{{ item.creater.nickname }}</li>
                                                    <li> 上传公司:{{ item.creater.company }}</li>
                                                    <li> 上传时间:{{ item.created_time }}</li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        {% endfor %}
                    {% endif %}
                {% endfor %}

                {#员工#}

                {% for item in collectdetail %}
                    {% if item.creater.nickname == current_user.nickname %}
                        <div class="col-sm-2" style="height: 400px">
                            <div class="row">
                                <div class="col-sm-8">
                                    <a type="button" class="btn btn-danger btn-sm"
                                       href="{{ buildUrl('/collect/detaildelete') }}?id={{ item.id }}'">删除
                                    </a>
                                </div>
                            </div>
                            <div class="thumbnail" onclick="window.location='{{ item.url }}';">
                                {#                            <a href="{{ item.url }}">#}
                                {% if item.type=="xls" or item.type=="xlsx" %}
                                    <img src="/static/pic/ico/excel.png" alt="...">
                                {% elif item.type=="pdf" %}
                                    <img src="/static/pic/ico/pdf.png" alt="...">
                                {% elif item.type=="doc" or item.type=="docx" %}
                                    <img src="/static/pic/ico/word.png" alt="...">
                                {% elif item.type=="jpg" or item.type=="jepg" or item.type=="png" %}
                                    <img src="/static/pic/ico/img.png" alt="...">
                                {% else %}
                                    <img src="/static/pic/ico/file.png" alt="...">
                                {% endif %}
                                {#                            </a>#}
                                <div class="caption">
                                    <div class="btn-group btn-group-justified " role="group"
                                         aria-label="...">
                                        <div class="btn-group" role="group">
                                            <h4 class="text-center"><strong>{{ item.name }}</strong></h4>
                                            <ul class="list-unstyled">
                                                <li> 上传人员:{{ item.creater.nickname }}</li>
                                                <li> 上传公司:{{ item.creater.company }}</li>
                                                <li> 上传时间:{{ item.created_time }}</li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    {% endif %}
                {% endfor %}



                <div class="col-sm-2 col-md-2">
                    <button data-toggle="modal" data-target="#exampleModal" style="background: #ffffff;border:0px;">
                        <img src="/static/pic/ico/add.png" alt="..."
                             style="height: 100px;margin-top: 50px;margin-left: 20px">
                    </button>
                </div>
            </div>
        </div>
    </div>


    {#模态框#}
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            {#    等待模态#}
            <div class="modal fade" id="loadingModal">
                <div style="width: 200px;height:20px; z-index: 20000; position: absolute; text-align: center; left: 50%; top: 50%;margin-left:-100px;margin-top:-10px">
                    <div class="progress progress-striped active" style="margin-bottom: 0;">
                        <div class="progress-bar" style="width: 100%;"></div>
                    </div>
                    <h5 style="color:black"><strong>正在上传文件，请耐心等待...</strong></h5>
                </div>
            </div>


            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">上传文件</h4>
                </div>
                <div class="modal-body">


                    {#暂存变量#}
                    <input class="form-control" id="pid" name="pid" style="display:none" value="{{ collectindex.id }}">
                    <input class="form-control" id="classone" name="classone" style="display:none"
                           value="{{ collectall.name }}">
                    <input class="form-control" id="classtwo" name="classtwo" style="display:none"
                           value="{{ collectindex.name }}">
                    <input class="form-control" id="uid" name="uid" style="display:none" value="{{ current_user.id }}">


                    <div class="form-group">
                        <div id="input">
                            <input id="upload_input" class="admin img-fluid" type="file">
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button class="btn btn-success do-upload" enctype="multipart/form-data">确定上传
                        </button>
                    </div>


                </div>
            </div>
        </div>
    </div>




{% endblock %}

{% block js %}
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    {#    <script src="static/js/moment-with-locales.js"></script>#}
    <script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
    <script src="{{ buildStaticUrl('/js/collect/collectdetail.js') }}"></script>

{% endblock %}
